<?php 
$weekarr = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$week = $weekarr[date("w")];
?>
<script type="text/javascript">
    function readURL(input,id) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $('#'+id).val(input.value);
            };
            reader.readAsDataURL(input.files[0]);
        }
    }
    function readURL2(input,id) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $('#'+id).val(input.value);
            };
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>
<style>
.profile table tr{display:block;}    
</style>
<div class="positiondiv">
    <table>
        <tr>
            <td class="td-left">
                <img src="<?=base_url()?>resource/img/home_ico.png" width="21" height="17">
                Profile > <a href="<?=base_url()?>profile/index">Profile</a> > Profile Detail
            </td>
            <td class="td-right">
                <img src="<?=base_url()?>resource/img/menu2.png" width="27" height="24">Today is <?=$week?>,<?=date('M d,Y')?>
            </td>
        </tr>
    </table>
</div>
<div class="detail-div">
    <div class="detail-menu">
        <div class="active1 single-menu" id="profilemenu1">Basic Info</div>
        <div class="active2 single-menu" id="profilemenu2">Candidate</div>
        <div class="active3 single-menu" id="profilemenu3">Company</div>
        <div class="active4 single-menu" id="profilemenu4">Attachments</div>
        <div style="width:0px;"></div>
    </div>
    <div class="input-div profile">
        <?php echo form_open('profile/edit_profile/'.$profile['id']); ?>
        <table>
            <tr><td colspan="2"><h3>.Base Information</h3></td></tr>
            <tr>
                <td class="nametd">Profile name:</td>
                <td>
                    <input type="hidden" name="workerid" value="<?=$worker['id']?>" />
                    <input type="hidden" name="workername" value="<?=$worker['name']?>" />
                    <input type="hidden" name="worktype" value="<?=$order['worktype']?>" />
                    <input type="hidden" name="application" value="<?=$profile['application']?>" />
                    <div style="float:left;height:20px;padding-top:10px;">
                        <?=$profile['name']?>
                    </div>
<!--                    <img src="<?=base_url()?>resource/img/reminder.png" id="normalreminder" type="0" class="imgreminder" 
                         title="reminder" time="0" profileid="<?=$profile['id']?>" />-->
                    <input type="hidden" value="<?=$profile['name']?>" name="profilename" />
                </td>
            </tr>
            <tr>
                <td class="nametd">Company Name:</td>
                <td><?=$company['name']?></td>
            </tr>
            <tr>
                <td class="nametd">Position:</td>
                <td><?=$order['position']?></td>
            </tr>
            <tr>
                <td class="nametd">Gender:</td>
                <td><?=$order['gender']==1?"Man":($order['gender']==2?"Female":"Unlimited")?></td>
            </tr>
            <tr>
                <td class="nametd">Salary:</td>
                <td><?=$order['salary']?></td>
            </tr>
            <tr>
                <td class="nametd">Work type:</td>
                <td><?=$order['worktype']==1?"WP":($order['worktype']==2?"SP":($order['worktype']==3?"EP":"Other"))?></td>
            </tr>
            <tr>
                <td class="nametd">Work Intro:</td>
                <td><label style="line-height:20px;"><?=$order['workintro']?></label></td>
            </tr>
            <tr>
                <td class="nametd">Comment:</td>
                <td><label style="line-height:20px;"><?=$order['comment']?></label></td>
            </tr>
            <tr>
                <td class="nametd">Createtime:</td>
                <td><?=date("d-m-Y h",$profile['createtime'])?></td>
            </tr>
            <tr>
                <td class="nametd">Last modified:</td>
                <td><?=date("d-m-Y h",$profile['updatetime'])?></td>
            </tr>
            <tr>
                <td class="nametd">Create person:</td>
                <td><?=$employee['name']?></td>
            </tr>
            <tr>
                <td class="nametd">Source:</td>
                <td><?=$profile['source']?></td>
            </tr>
            <tr><td class="nametd">Apply Employee:</td>
                <td><?=$employee['name']?></td>
            </tr>
            <?php if($profile['applytime'] != NULL&&$profile['applytime'] != ""){?>
            <tr><td class="nametd">Apply Time:</td>
                <td>
                    <div style="float:left;height:20px;padding-top:10px;">
                        <?=date("d-m-Y H:i",$profile['applytime'])?>
                    </div>
<!--                    <img src="<?=base_url()?>resource/img/reminder.png" id="applyreminder" type="2" class="imgreminder" 
                         title="reminder" time="<?=$profile['applytime']?>" profileid="<?=$profile['id']?>" />-->
                </td>
            </tr>
            <?php }?>
            <?php if($profile['approvetime'] != NULL&&$profile['approvetime'] != ""){?>
            <tr><td class="nametd">Approve Time:</td>
                <td><?=date("d-m-Y H:i",$profile['approvetime'])?></td>
            </tr>    
                <?php if($order['id'] != 0 && $order['worktype']==1){?>
                    <tr><td class="nametd">Buy SB Date:</td>
                        <td><?=date("d-m-Y H:i",$profile['buysbdate'])?></td>
                    </tr>  
                <?php }?>
            <?php }?>
            <?php if($profile['arrivedtime'] != NULL&&$profile['arrivedtime'] != ""){?>
            <tr><td class="nametd">Arrived Time:</td>
                <td>
                    <div style="float:left;height:20px;padding-top:10px;">
                        <?=date("d-m-Y H:i",$profile['arrivedtime'])?>
                    </div>
<!--                    <img src="<?=base_url()?>resource/img/reminder.png" id="arrivedreminder" type="1" class="imgreminder" 
                         title="reminder" time="<?=$profile['arrivedtime']?>" profileid="<?=$profile['id']?>" />-->
                </td>
            </tr>
            <tr><td class="nametd">Flight No:</td>
                <td><?=$profile['flightno']?></td>
            </tr>
            <tr><td class="nametd">Terminal:</td>
                <td><?=$profile['terminal']?></td>
            </tr>  
            <?php }?>
            <?php if($worker['address'] != null && trim($worker['address'])!=''){?>
            <tr><td class="nametd">Residential Address:</td>
                <td><?=$worker['address']?></td>
            </tr>    
            <?php }?>
            <?php if($worker['number'] != null && trim($worker['number'])!=''){?>
            <tr><td class="nametd">Worker Mobile:</td>
                <td><?=$worker['number']?></td>
            </tr>
            <?php }?>
            <?php if($profile['issuetime'] != NULL&&$profile['issuetime'] != ""){?>
            <tr><td class="nametd">Issue Time:</td>
                <td><?=date("d-m-Y H:i",$profile['issuetime'])?></td>
            </tr>   
            <tr><td class="nametd">MI:</td>
                <td><?=$profile['wi']==0?"Y(R)":($profile['wi']==1?"Y(B)":"N")?> &nbsp;
                    <?=$profile['mitime']?></td>
            </tr>
            <tr><td class="nametd">WICI:</td>
                <td><?=$profile['wici']==0?"Y(R)":($profile['wici']==1?"Y(B)":"N")?> &nbsp;
                    <?=$profile['wicitime']?></td>
            </tr>
            <?php }?>
            <?php if($profile['returntime'] != NULL&&$profile['returntime']!=""){?>
            <tr><td class="nametd">Return Time:</td>
                <td><?=date("d-m-Y H:i",$profile['returntime'])?></td>
            </tr>    
            <?php }?>
            <?php if($profile['rejectedtime'] != NULL&&$profile['rejectedtime']!=""){?>
            <tr><td class="nametd">Rejected Time:</td>
                <td><?=date("d-m-Y H:i",$profile['rejectedtime'])?></td>
            </tr>    
            <?php }?>
            <?php if($profile['othertime'] != NULL&&$profile['othertime']!=""){?>
            <tr><td class="nametd">Other Time:</td>
                <td><?=date("d-m-Y H:i",$profile['othertime'])?></td>
            </tr>    
            <?php }?>
            <?php if($profile['canceldate'] != NULL&&$profile['canceldate'] != ""){?>
            <tr><td class="nametd">Cancel Date:</td>
                <td><?=date("d-m-Y H:i",$profile['canceldate'])?></td>
            </tr>    
            <tr><td class="nametd">Last Date:</td>
                <td><?=date("d-m-Y H:i",$profile['lastdate'])?></td>
            </tr>
            <?php }?>
            <tr><td class="nametd">Create Time:</td>
                <td>
                    <?=date("d-m-Y H:i:s",$profile['createtime'])?>
                </td>
            </tr>
            <tr><td class="nametd">Last modified:</td>
                <td>
                    <?=date("d-m-Y H:i:s",$profile['updatetime'])?>
                </td>
            </tr>
            <tr><td class="nametd">Status:</td>
                <td>
                    <input type="radio" name="status" value="0" id="initial" /><label for="initial">Initial</label>
                    <input type="radio" name="status" value="1" id="pending" timename="Application Date" /><label for="pending">Application</label>
                    <input type="radio" name="status" value="2" id="approve" timename="Approve Date" /><label for="approve">Approve</label>
                    <input type="radio" name="status" value="6" id="rejected" timename="Rejected Date" /><label for="rejected">Rejected</label>
                    <input type="radio" name="status" value="3" id="arrived" timename="Arrived Date" /><label for="arrived">Arrived</label>
                    <input type="radio" name="status" value="4" id="Issue" timename="Issue Date" /><label for="Issue">Issue</label>
                    <input type="radio" name="status" value="7" id="other" timename="Appointment Date" /><label for="other">Appointment</label>
                    <input type="radio" name="status" value="8" id="cancel" timename="Cancel Date" /><label for="cancel">Cancel</label>
                    <input type="radio" name="status" value="5" id="return" timename="Return Date" /><label for="return">Return</label>
                </td>
            </tr>
            <tr class="statustime"><td class="nametd" id="statustimename">Status Date:</td>
                <td><input type="text" name="statustime" id="statustime" style="width:120px;"/></td>
            </tr>
            <tr class="flight" style="display:none;"><td class="nametd">Flight No:</td>
                <td><input type="text" name="flightno" id="flightno" style="width:120px;" value="<?=$profile['flightno']?>"/></td>
            </tr>
            <tr class="flight" style="display:none;"><td class="nametd">Terminal:</td>
                <td><input type="text" name="terminal" id="terminal" style="width:120px;" value="<?=$profile['terminal']?>"/></td>
            </tr>
            <tr class="lastdate" style="display:none;"><td class="nametd">Last Date:</td>
                <td><input type="text" name="lastdate" id="lastdate" style="width:120px;" value="<?=($profile['lastdate'] != NULL)?date('Y-m-d H:i',$profile['lastdate']):''?>"/></td>
            </tr>
            <tr class="buysbdate" style="display:none;"><td class="nametd" id="buysbdatename">Buy SB Date:</td>
                <td><input type="text" name="buysbdate" id="buysbdate" style="width:120px;" value="<?=($profile['buysbdate'] != NULL&&$profile['buysbdate'] != ''&&$profile['buysbdate'] != 0)?date('Y-m-d H:i',$profile['buysbdate']):''?>"/></td>
            </tr>
            <tr class="accomodation" style="display:none;"><td class="nametd" id="accomodationname">Accomodation:</td>
                <td>
                    <input type="radio" name="accomodation" id="accomodation0" value="0" checked="checked" /><label for="accomodation0">Y</label>
                    <input type="radio" name="accomodation" id="accomodation1" value="1" /><label for="accomodation1">N</label>
                </td>
            </tr>
            <tr class="housecompanyid" style="display:none;"><td class="nametd" id="housecompanyidname">Residential Address:</td>
                <td>
<!--                    <select name="housecompanyid" id="housecompanyid" style="width:400px;">
                        <?php foreach ($houseagent as $key => $value) {?>
                            <option value="<?=$value['id']?>"><?=$value['name']?>:<?=$value['address']?>
                        <?php }?>
                    </select>-->
                    <input type="text" name="housecompanyid" id="housecompanyid" list="list" />
                    <datalist id="list">
                        <?php foreach ($houseagent as $key => $value) {?>
                            <option value="<?=$value['id']?>:<?=$value['name']?>:<?=$value['address']?>">
                        <?php }?>
                    </datalist>
                </td>
            </tr>
            <tr class="workernumber" style="display:none;"><td class="nametd" id="workernumbername">Worker Mobile:</td>
                <td><input type="text" name="workernumber" id="workernumber" style="width:120px;" value="<?=$worker['number']?>"/></td>
            </tr>
            <tr class="issueinput" style="display:none;"><td class="nametd" id="winame">MI:</td>
                <td>
                    <input type="radio" name="wi" id="wi0" value="0" checked="checked" /><label for="wi0">Y(R)</label>
                    <input type="radio" name="wi" id="wi1" value="1" /><label for="wi1">Y(B)</label>
                    <input type="radio" name="wi" id="wi2" value="2" /><label for="wi2">N</label>
                    <input type="text" name="mitime" id="mitime" style="width:120px;" 
                           value="<?=$profile['mitime']?>"/>
                </td>
            </tr>
            <tr class="issueinput" style="display:none;"><td class="nametd" id="winame">WICI:</td>
                <td>
                    <input type="radio" name="wici" id="wici0" value="0" checked="checked" /><label for="wici0">Y(R)</label>
                    <input type="radio" name="wici" id="wici1" value="1" /><label for="wici1">Y(B)</label>
                    <input type="radio" name="wici" id="wici2" value="2" /><label for="wici2">N</label>
                    <input type="text" name="wicitime" id="wicitime" style="width:120px;" 
                           value="<?=$profile['wicitime']?>"/>
                </td>
            </tr>
            <?php if($this->session->userdata('department') == 1){?>
            <tr>
                <td class="nametd"></td>
                <td>
                    <input type="submit" value="Submit" name="Submit"/>
                </td>
            </tr>
            <?php }?>
        </table>
        <?php echo form_close(); ?>
    </div>
    <div class="input-div candidate" style="display:none;">
        <table class="list-table">
            <tr><td colspan="2"><h3>.Candidate Information</h3></td></tr>
            <tr>
                <td class="nametd">Passportno:</td>
                <td><?=$worker['passportno']?></td>
            </tr>
            <tr>
                <td class="nametd">Name:</td>
                <td><?=$worker['name']?></td>
            </tr>
            <tr>
                <td class="nametd">Gender:</td>
                <td><?=$worker['gender']==1?"M":($worker['gender']==2?"F":"Unlimit")?></td>
            </tr>
            <tr>
                <td class="nametd">Nationality:</td>
                <td><?=$worker['nationality']==1?"Malaysia":($worker['nationality']==2?"China":($worker['nationality']==3?"Vietnam":($worker['nationality']==4?"Myanmar":$worker['nationality'])))?></td>
            </tr>
            <tr>
                <td class="nametd">Birthday:</td>
                <td><?=$worker['birthday']?></td>
            </tr>
            <tr>
                <td class="nametd">Expect Position:</td>
                <td><?=$worker['position']?></td>
            </tr>
            <tr>
                <td class="nametd">Speciality:</td>
                <td><?=$worker['speciality']?></td>
            </tr>
            <tr>
                <td class="nametd">Status:</td>
                <td><?=$worker['status']==0?"Applicable":"N.A."?></td>
            </tr>
            <tr>
                <td class="nametd">Location:</td>
                <td><?=$worker['location']==0?"Overseas":"Singapore"?></td>
            </tr>
            <tr>
                <td class="nametd">Pass Type:</td>
                <td><?=$worker['passtype']==1?WP:($worker['passtype']==2?"SP":($worker['passtype']==3?"EP":($worker['passtype']==4?"SVP":($worker['passtype']==5?"DP":"Other"))))?></td>
            </tr>
            <tr>
                <td class="nametd">Comment:</td>
                <td><?=$worker['comment']?></td>
            </tr>
        </table>
    </div>
    <div class="input-div company" style="display:none;">
        <table>
            <tr><td colspan="2"><h3>.Conpany Information</h3></td></tr>
            <tr>
                <td class="nametd">Company SN:</td>
                <td><?=$company['sn']?></td>
            </tr>
            <tr>
                <td class="nametd">Company Name:</td>
                <td><?=$company['name']?></td>
            </tr>
            <tr>
                <td class="nametd">Industry:</td>
                <td><?=$industry['name']?></td>
            </tr>
            <tr>
                <td class="nametd">Contact person:</td>
                <td><?=$company['person']?></td>
            </tr>
            <tr>
                <td class="nametd">Contact position:</td>
                <td><?=$company['position']?></td>
            </tr>
            <tr>
                <td class="nametd">Contact number:</td>
                <td><?=$company['number']?></td>
            </tr>
            <tr>
                <td class="nametd">Contact email:</td>
                <td><?=$company['email']?></td>
            </tr>
            <tr>
                <td class="nametd">Comment:</td>
                <td><label style="line-height:20px;"><?=$company['comment']?></label></td>
            </tr>
            <tr>
                <td class="nametd">Createtime:</td>
                <td><?=date("M d,Y h",$company['createtime'])?></td>
            </tr>
            <tr>
                <td class="nametd">Last modified:</td>
                <td><?=date("M d,Y h",$company['updatetime'])?></td>
            </tr>
        </table>
    </div>
    <div class="list-div attachments" style="display:none;">
        <table class="list-table">
            <tr>
                <!--<th width="200">Attachment Name</th>-->
                <th>Attachment</th>
                <th width="100"></th>
            </tr>
            <?php foreach ($attachments as $key => $value) {?>
            <tr>
                <!--<td><?=$value['title']?></td>-->
                <td><a href="<?=base_url("index/downfile").'/'.$value['path']?>" target="_blank"><?=$value['path']?></a></td>
                <td>
                    <a href="<?=base_url('index/deleteattachment2').'/'.$value['id'].'/'.$profile['id'] ?>" class="buttona">
                        <img src="<?=base_url()?>resource/img/delete.png"/>delete
                    </a>
                </td>
            </tr>
            <?php }?>
            <tr>
                <td colspan="2" class="relative" style="text-align:left;">
                    <form action="<?=base_url('index/newattachment/'.$profile['id'].'/'.$attachmenttype)?>" method="post" enctype="multipart/form-data" onsubmit="return checkform()">
                        <!--<input type="text" name="title" placeholder="attachment title" id="title" style="width:180px;margin-left:10px;margin-right:10px;" />-->
                        <input type="text" placeholder="attachment path" id="attachmentpath" style="width:640px;margin-left:30px;margin-right:30px;"/>
                        <img src="<?=base_url()?>resource/img/upload.png" width="25" height="29" style="position:absolute;left:645px;top:3px;" />
                        <input type="file" id="path" class="inputfile" name="path" size="20" onchange="readURL2(this,'attachmentpath');" 
                               style="position:absolute;width:25px;height:29px;left:645px;top:3px;cursor:pointer;opacity:0;filter:alpha(opacity=0);"/>
                        <input type="submit" style="position:absolute;width:29px;height:29px;background:#ffffff url(<?=base_url()?>resource/img/save.png) no-repeat;
                               background-repeat:round;right:40px;top:4px;cursor:pointer;border:none;" value=""/>
                        <input type="hidden" name="title" value="profileattachment" />
                    </form>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>
var profileid = '<?=$profile['id']?>';
init();
function init(){
    if($.session.get('profiledetailid'+profileid) != undefined){
        var id = $.session.get('profiledetailid'+profileid);
        setMenu(id);
        $("#"+id).removeClass("single-menu").addClass("detail-active");
    }else{
        $.session.set('profiledetailid'+profileid,"profilemenu1");
        $("#profilemenu1").removeClass("single-menu").addClass("detail-active");
    }
    
    var status = "<?=$profile['status']?>";
//    $("input[name='status']:eq(<?=$profile['status']?>)").attr("checked","checked\n\
    $("input[name='status']").each(function(){
        if($(this).val() == status){
            $(this).attr("checked","checked");
        }
    });
    if("<?=$profile['status']?>" == 0){
        $(".statustime").css("display","none");
    }else if("<?=$profile['status']?>" == 3){
        $(".flight").css("display","block");
        $(".accomodation").css("display","block");
        $("input[name='accomodation']:eq(<?=$worker['isneedaccommodation']?>)").attr("checked","checked");
        if("<?=$worker['isneedaccommodation']?>" == 1){
            $(".housecompanyid").css("display","block");
            $("#housecompanyid").val("<?=$worker['address']?>");
        }
        $(".workernumber").css("display","block");
    }else if("<?=$profile['status']?>" == 8){
        $(".lastdate").css("display","block");
    }else if("<?=$profile['status']?>" == 2){
        if(<?=$order['id']?> != 0 && <?=$order['worktype']?> == 1){
            $(".buysbdate").css("display","block");
        }
    }else if("<?=$profile['status']?>" == 4){
        $(".issueinput").css("display","block");
    }
    
    $("input[name='wi']:eq(<?=$profile['wi']?>)").attr("checked","checked");
    $("input[name='wici']:eq(<?=$profile['wici']?>)").attr("checked","checked");
}    

cutmenu();
function cutmenu(){
    $(".single-menu").click(function(){
        $(".single-menu").unbind("click");
        $(".detail-active").removeClass("detail-active").addClass("single-menu");
        $(this).removeClass("single-menu").addClass("detail-active");
        var id = $(this).attr("id");
        $.session.set('profiledetailid'+profileid,id);
        setMenu(id);
        cutmenu();
    });
}

function setMenu(id){
    if(id == "profilemenu1"){
        $(".profile").css("display","block");
        $(".candidate").css("display","none");
        $(".company").css("display","none");
        $(".attachments").css("display","none");
    }else if(id == "profilemenu2"){
        $(".profile").css("display","none");
        $(".candidate").css("display","block");
        $(".company").css("display","none");
        $(".attachments").css("display","none");
    }else if(id == "profilemenu3"){
        $(".profile").css("display","none");
        $(".candidate").css("display","none");
        $(".company").css("display","block");
        $(".attachments").css("display","none");
    }else if(id == "profilemenu4"){
        $(".profile").css("display","none");
        $(".candidate").css("display","none");
        $(".company").css("display","none");
        $(".attachments").css("display","block");
    }
}

$("input[name='status']").click(function(){
    $("input[name='status']").each(function(){
        if($(this).attr("checked") == "checked"){
            if($(this).val() != 0){
                $(".statustime").css("display","block");
                var timename = $(this).attr("timename");
                $("#statustimename").html(timename);
                if($(this).val() == 3){
                    $(".flight").css("display","block");
                    $(".workernumber").css("display","block");
                    $(".lastdate").css("display","none");
                    $(".buysbdate").css("display","none");
                    $(".accomodation").css("display","block");
                    if($("input[name='accomodation']:eq(1)").attr("checked")){
                        $(".housecompanyid").css("display","block");
                    }else{
                        $(".housecompanyid").css("display","none");
                    }
                    $(".issueinput").css("display","none");
                }else if($(this).val() == 8){
                    $(".lastdate").css("display","block");
                    $(".buysbdate").css("display","none");
                    $(".flight").css("display","none");
                    $(".accomodation").css("display","none");
                    $(".housecompanyid").css("display","none");
                    $(".issueinput").css("display","none");
                    $(".workernumber").css("display","none");
                }else if($(this).val() == 2){
                    if(<?=$order['id']?> != 0 && <?=$order['worktype']?> == 1){
                        $(".buysbdate").css("display","block");
                    }
                    $(".flight").css("display","none");
                    $(".lastdate").css("display","none");
                    $(".accomodation").css("display","none");
                    $(".housecompanyid").css("display","none");
                    $(".issueinput").css("display","none");
                    $(".workernumber").css("display","none");
                }else if($(this).val() == 4){//issue
                    $(".issueinput").css("display","block");
                    $(".lastdate").css("display","none");
                    $(".buysbdate").css("display","none");
                    $(".flight").css("display","none");
                    $(".accomodation").css("display","none");
                    $(".housecompanyid").css("display","none");
                    $(".workernumber").css("display","none");
                }else{
                    $(".flight").css("display","none");
                    $(".lastdate").css("display","none");
                    $(".buysbdate").css("display","none");
                    $(".accomodation").css("display","none");
                    $(".housecompanyid").css("display","none");
                    $(".issueinput").css("display","none");
                    $(".workernumber").css("display","none");
                }
            }else{
                $(".statustime").css("display","none");
                $(".flight").css("display","none");
                $(".lastdate").css("display","none");
                $(".buysbdate").css("display","none");
                $(".accomodation").css("display","none");
                $(".housecompanyid").css("display","none");
                $(".issueinput").css("display","none");
                $(".workernumber").css("display","none");
            }
        }
    });
});

$("input[name='accomodation']").click(function(){
    var id = $(this).attr("id");
    if(id == "accomodation1"){
        $(".housecompanyid").css("display","block");
    }else{
        $(".housecompanyid").css("display","none");
    }
});

$(".tenement").click(function(){
    var workerid = $(this).attr("workerid");
    var iTop = (document.body.clientHeight-30-600)/2; //获得窗口的垂直位置;
    var iLeft = (document.body.clientWidth-10-800)/2; //获得窗口的水平位置;
    window.open('<?=base_url("profile/tenement")?>/'+workerid,'_blank',
    'width=800,height=600,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,top='+iTop+',left='+iLeft); 
});

$('#statustime').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});

$('#buysbdate').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});

$('#lastdate').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});

$('#mitime').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});
$('#wicitime').datetimepicker({
    format:"Y-m-d H:i",
    step:10
});

$(".imgreminder").click(function(){
    var type = $(this).attr("type");
    var time = $(this).attr("time");
    var profileid = $(this).attr("profileid");
    var iTop = (document.body.clientHeight-30-600)/2; //获得窗口的垂直位置;
    var iLeft = (document.body.clientWidth-10-800)/2; //获得窗口的水平位置;
    window.open('<?=base_url("reminder/profile_reminders")?>/'+type+'/'+time+'/'+profileid,'_blank',
    'width=800,height=600,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,top='+iTop+',left='+iLeft);
});
</script>
